package kamikaze.service.admin;

import kamikaze.support.HttpMethod;
import kamikaze.support.Service;
import kamikaze.support.ServiceConfig;
import kamikaze.support.ServiceContext;

@ServiceConfig(path = "admin/list_user", method = HttpMethod.GET)
public class AdminListUserPage implements Service {

	@Override
	public String serve(ServiceContext ctx) throws Exception {
		ctx.getUserSession().ensureLoginAsAdmin();
		ctx.getRequest().setAttribute("userList",
				ctx.getEntityManager().createQuery("select p from User p").getResultList());

		return "admin/list_user";
	}

}
